<?


//simple client
require('lib/nusoap.php');

//要发送的变量
$myString="world";

//parameters must be passed as an array
//变量必须要转换成数组的形式
$parameters=array('10','20','30');
print_r($parameters);

//创建一个soapclient对象，参数是server的URL
$s=new nusoap_client('http://www.ihomechina.com/nusoap/server.php');

//调用远程方法，返回值存放在$result
//返回值为PHP的变量类型，如string, integer, array
//$result=$s->call('echoString', $parameters);

//$result = $s->call('adddata',$parameters);
$result = $s->call('echoArray', $parameters);

//错误检测
if (!$err=$s->getError()) {
echo 'Result: '.$result[0]; //success
echo '<br>';
echo 'Result: '.$result[1]; 
echo '<br>';
echo 'Result: '.$result[2]; 


} else {
echo 'Error: '.$err;


echo "＜xmp＞".$s->request."＜/xmp＞";
echo "<br>";
echo "＜xmp＞".$s->response."＜/xmp＞";
}

//调试，以下是SOAP请求(request)和回应(response)的报文，包括HTTP头
//echo "＜xmp＞".$s->request."＜/xmp＞";
//echo "＜xmp＞".$s->response."＜/xmp＞";

?>

